package com.fly.caihong.activity;

import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentStatePagerAdapter;
import android.support.v4.view.ViewPager;

import com.fly.caihong.R;
import com.fly.caihong.base.BaseActivity;
import com.fly.caihong.frag.WelcomeFragment;
import com.fly.caihong.utils.StatusBarUtils;

public class WelcomeActivity extends BaseActivity {

    private ViewPager mViewPager;

    @Override
    public void onCreate(@Nullable Bundle savedInstanceState) {
        StatusBarUtils.setTransparent(this);
        super.onCreate(savedInstanceState);
    }

    @Override
    protected void setStatusBarStyle() {

    }

    @Override
    protected int getLayout() {
        return R.layout.activity_welcome;
    }

    @Override
    protected void initViews() {
        super.initViews();
        mViewPager = findViewById(R.id.vp_welcome);
        StatusBarUtils.assistNavigationBar(this, mViewPager);
    }

    @Override
    protected void initData() {
        super.initData();
        mViewPager.setAdapter(new MyAdapter(getSupportFragmentManager()));
    }

    private class MyAdapter extends FragmentStatePagerAdapter {

        public MyAdapter(FragmentManager fm) {
            super(fm);
        }

        @Override
        public Fragment getItem(int position) {
            return WelcomeFragment.newInstance(position);
        }

        @Override
        public int getCount() {
            return 3;
        }

    }

}
